<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="button" value="打开" id="openb">
		<input type="button" value="关闭" id="closeb">
		<script>
			//开一个百度窗口,open()返回新的window对象
			var openb=document.getElementById("openb");
			var nwindow;
			openb.onclick=function(){
				nwindow=open("https://www.baidu.com");
			}
			//关闭开的窗口，close()关闭调用它的窗口,ex:nwindow
			var closeb=document.getElementById("closeb");
			closeb.onclick=function(){
				nwindow.close();
			}
			
			
			
			
		</script>
		
		
		
	</body>
</html>